﻿///--------------------------------------------------------------------
/// <file name="FXDom.debug.js">
///   A documentation file to aid VS IntelliSense for the FXDom API.
///
///   DO NOT INCLUDE IN NAMFOX DISTRIBUTIONS!
/// </file>
///--------------------------------------------------------------------

var FXDom = $FX = function(selector, document) {
    /// <param name="selector">
    ///   1. #ID - The ID of a specific element.
    ///   2. .class - Specifies to retrieve elements with the specified class name.
    ///   3. DOM elements
    /// </param>
    /// <param name="document" optional="true" domElement="true">
    ///    (Optional) The HTMLDocument instance in which to look for the elements specified by the selector.
    ///    Required if the selector is not a DOM element.
    /// </param>
    /// <field name="length" type="Number" integer="true">The number of DOM elements in this FXDom instance.</field>
    /// <returns type="FXDom" />
    
}

FXDom.prototype = {
    _document: null,
    length: 0,
    
    each: function(callback) {
        /// <summary>Iterates the collection of DOM elements encapsulated by this FXDom object and applies a callback to each one.</summary>
        /// <param name="callback" type="Function">The function to call each element with.</param>
        /// <returns type="FXDom" />
    },
    
    init: function(selector) {
        /// <summary>Selects elements with the given expression.</summary>
        /// <param name="selector">
        ///   1. #ID - The ID of a specific element.
        ///   2. .class - Specifies to retrieve elements with the specified class name.
        ///   3. DOM elements
        /// </param>
        /// <returns type="FXDom" />
    },
    
    setArray: function(array) {
        /// <summary>Completely overwrites the elements internalized by this FXDom instance with the contents of array.</summary>
        /// <param name="array" type="Array">An array of DOM elements.</param>
        /// <returns type="FXDom" />
    },
    
    clean: function(elements, context) {
        /// <summary>Cleans up the data in elements to represent a collection of HTML DOM elements.</summary>
        /// <param name="elements">A collection of DOM elements or a string of HTML.</param>
        /// <param name="context">The context in which these elements should exist.</param>
    },
    
    append: function() {
        /// <summary>
        ///     Append content to the inside of every matched element.
        ///     This operation is similar to doing an appendChild to all the
        ///     specified elements, adding them into the document.
        /// </summary>
        /// <returns type="FXDom" />
    },
    
    prepend: function() {
        /// <summary>
        ///     Prepends content to the inside of every matched element.
        ///     This operation is similar to doing an appendChild to all the
        ///     specified elements, adding them into the document.
        /// </summary>
        /// <returns type="FXDom" />
    },
    
    before: function() {
        /// <summary>
        ///     Insert content before each of the matched elements.
        /// </summary>
        /// <returns type="FXDom" />
    },
    
    after: function() {
        /// <summary>
        ///     Insert content after each of the matched elements.
        /// </summary>
        /// <returns type="FXDom" />
    },

    replaceWith: function() {
        /// <summary>
        /// Replaces the selected elements with the specified arguments.
        /// </summary>
        /// <returns type="FXDom" />
    },
    
    domManip: function(args, table, reverse, callback) {
        /// <summary>Manipulates the DOM using the specified elements and a callback to do the actual work.</summary>
        /// <param name="args" type="Array">The HTML elements used to manipulate the DOM.</param>
        /// <param name="table" type="Boolean">True to insert a TBODY in TABLEs if one is not found.</param>
        /// <param name="reverse type="Boolean">True to reverse the elements in args.</param>
        /// <param name="callback" type="Function">The function doing the DOM manipulation.</param>
        /// <returns type="FXDom" />
    },
    
    attr: function(name, value) {
        /// <summary>
        ///    Gets an attribute of the first element in this FXDom object
        ///    or sets multiple attributes for all elements in this FXDom object.
        /// </summary>
        /// <param name="name" type="Object">
        ///    The name of a single attribute or an object that specifies the names
        ///    and values of attributes to set.
        /// </param>
        /// <param name="value" type="Object">
        ///    The value of the single attribute to set.
        /// </param>
        /// <returns type="FXDom" />
    },
    
    css: function(name, value) {
        /// <summary>
        ///    Gets a style attribute of the first element in this FXDom object
        ///    or sets multiple attributes for all elements in this FXDom object.
        /// </summary>
        /// <param name="name" type="Object">
        ///    The name of a single style attribute or an object that specifies the names
        ///    and values of style attributes to set.
        /// </param>
        /// <param name="value" type="Object">
        ///    The value of the single style attribute to set.
        /// </param>
        /// <returns type="FXDom" />
    },
    
    empty: function() {
        /// <summary>Removes all content from the selected elements.</summary>
        /// <returns type="FXDom" />
    },
    
    get: function(index) {
        /// <summary>
        ///    Gets all DOM elements in an array, if index is not specified. Otherwise, gets the DOM element
        ///    at the specified index, if it exists.
        /// </summary>
        /// <param name="index" optional="true">(Optional) The index of a DOM element to retrieve.
        /// <returns type="Object">A DOM element or an array of DOM elements.</returns>
    },
    
    html: function(value) {
        /// <summary>Gets or sets the innerHTML attribute of each element.</summary>
        /// <param name="value">The new HTML.</param>
        /// <returns type="String"/>
    },

    outerHtml: function() {
        /// <summary>Returns the HTML, including this node, of the first selected element.</summary>
        /// <returns type="String" />
    },
    
    find: function(selector) {
        /// <summary>
        ///   Using the currently selected elements as a context, this function
        ///   finds children of those elements according to the selector.
        /// </summary>
        /// <param name="selector" type="String">The selector used to find new elements.</param>
        /// <returns type="FXDom" />
    },
    
    parent: function() {
        /// <summary>Selects the parents of all currently selected elements.</summary>
        /// <returns type="FXDom" />
        
        var parents = [];
        
        this.each(
            function(i, element) {
                parents.push(element.parentNode);
            }
        );
        
        return this;
    },
    
    remove: function() {
        /// <summary>Removes all currently selected elements from the DOM tree.</summary>
        /// <returns type="FXDom" />
        
        this.each(
            function(i, element) {
                element.parentNode.removeChild(element);
            }
        );
        
        return this;
    },
    
    val: function(value) {
        /// <summary>Gets or sets the value attribute of each element.</summary>
        /// <param name="value">The new value.</param>
        /// <returns type="Object"/>
    }
};

FXDom.prototype.blur = function(callback) {
    /// <summary>Registers a callback function for the blur event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the blur event occurs.</param>
};

FXDom.prototype.command = function(callback) {
    /// <summary>Registers a callback function for the command event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the command event occurs.</param>
};

FXDom.prototype.focus = function(callback) {
    /// <summary>Registers a callback function for the focus event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the focus event occurs.</param>
};

FXDom.prototype.load = function(callback) {
    /// <summary>Registers a callback function for the load event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the load event occurs.</param>
};

FXDom.prototype.resize = function(callback) {
    /// <summary>Registers a callback function for the resize event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the resize event occurs.</param>
};

FXDom.prototype.scroll = function(callback) {
    /// <summary>Registers a callback function for the scroll event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the scroll event occurs.</param>
};

FXDom.prototype.unload = function(callback) {
    /// <summary>Registers a callback function for the unload event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the unload event occurs.</param>
};

FXDom.prototype.click = function(callback) {
    /// <summary>Registers a callback function for the click event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the click event occurs.</param>
};

FXDom.prototype.dblclick = function(callback) {
    /// <summary>Registers a callback function for the dblclick event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the dblclick event occurs.</param>
};

FXDom.prototype.mousedown = function(callback) {
    /// <summary>Registers a callback function for the mousedown event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the mousedown event occurs.</param>
};

FXDom.prototype.mouseup = function(callback) {
    /// <summary>Registers a callback function for the mouseup event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the mouseup event occurs.</param>
};

FXDom.prototype.mousemove = function(callback) {
    /// <summary>Registers a callback function for the mousemove event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the mousemove event occurs.</param>
};

FXDom.prototype.mouseover = function(callback) {
    /// <summary>Registers a callback function for the mouseover event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the mouseover event occurs.</param>
};

FXDom.prototype.mouseout = function(callback) {
    /// <summary>Registers a callback function for the mouseout event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the mouseout event occurs.</param>
};

FXDom.prototype.change = function(callback) {
    /// <summary>Registers a callback function for the change event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the change event occurs.</param>
};

FXDom.prototype.select = function(callback) {
    /// <summary>Registers a callback function for the select event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the select event occurs.</param>
};

FXDom.prototype.submit = function(callback) {
    /// <summary>Registers a callback function for the submit event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the submit event occurs.</param>
};

FXDom.prototype.keydown = function(callback) {
    /// <summary>Registers a callback function for the keydown event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the keydown event occurs.</param>
};

FXDom.prototype.keypress = function(callback) {
    /// <summary>Registers a callback function for the keypress event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the keypress event occurs.</param>
};

FXDom.prototype.keyup = function(callback) {
    /// <summary>Registers a callback function for the keyup event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the keyup event occurs.</param>
};

FXDom.prototype.error = function(callback) {
    /// <summary>Registers a callback function for the error event on the elements encapsulated by the FXDom object.</summary>
    /// <param name="callback">The callback to invoke when the error event occurs.</param>
};

FXDom.attr = function(element, name, value) {
    /// <summary>Gets or sets an attribute on a particular element.</summary>
    /// <param name="element" domElement="true">The DOM element with which to get or set an attribute.</param>
    /// <param name="name">The name of the attribute to get or set.</param>
    /// <param name="value">The value of the attribute to set.</param>
    /// <returns type="Object">The value of the attribute specified in the name parameter.</returns>
    
    if (element && value === undefined) {
        return element[name];
    }
    
    element[name] = value;
    
    return value;
}

FXDom.nodeName = function(element, name) {
    /// <summary>
    ///     Checks whether the specified element has the specified DOM node name.
    /// </summary>
    /// <param name="element" type="Element">The element to examine</param>
    /// <param name="name" type="String">The node name to check</param>
    /// <returns type="Boolean">True if the specified node name matches the node's DOM node name; otherwise false</returns>
};

FXDom.makeArray = function(array) {
    /// <summary>
    ///     Turns anything into a true array.  This is an internal method.
    /// </summary>
    /// <param name="array" type="Object">Anything to turn into an actual Array</param>
    /// <returns type="Array" />
    /// <private />
};

FXDom.each = function(object, callback, context) {
    /// <summary>Iterates over an array or an object's properties until the callback function returns false.</summary>
    /// <param name="object" type="Object">The object whose indices or properties should be iterated.</param>
    /// <param name="callback" type="Function">The callback function to invoke for each argument of the array.</param>
    /// <param name="context" type="Object" optional="true">(Optional) The context (i.e. the this object) in which the callback is called.</param>
};